import 'package:flutter/material.dart';

import '../../class/cross/cross_group.dart';
import '../../commont/base_group_grid.dart';
import '../../model/model.dart';

class EqGroup extends BaseGroupGrid {
  void Function(GroupModel) onLongPress;
  EqGroup(
      {super.key,
      required super.list,
      required super.onClick,
      required this.onLongPress})
      : super();

  @override
  State<EqGroup> createState() => _EqGroupState();
}

class _EqGroupState extends BaseGroupGridState<EqGroup> {
  @override
  List<List<Widget>> buildContent() {
    List<List<Widget>> result = [];
    for (var sub_list in widget.list as List<List<GroupModel>>) {
      List<Widget> temp = [];
      for (var model in sub_list) {
        var btn = GroupItem(group: model)
          ..onClick = (group) {
            widget.onClick(group);
          }
          ..onLongPress = (group) {
            widget.onLongPress(group);
          };
        temp.add(btn);
      }
      result.add(temp);
    }
    return result;
  }
}
